function wjCoherence(B::Array{Float64,2})
#   ines thecoherenceof amatrix B as 
# mu(B) = max_{k,j} abs(<B(:,k),B(:,j)>)/(norm(B(:,k),2) * norm(B(:,j),2))
    u=Inf
    for k=1:size(B,2) # size(B,2) return the number of colummn
        for j=1:(k-1)
            len=(sum(B[:,k].^2).^.5)*(sum(B[:,j].^2).^.5)
            innerProd=abs(sum(B[:,k].*B[:,j]))
            u= minimum([u,innerProd/len])
        end
    end
    return u
end

wjCoherence(B) = wjCoherence(convert(Array{Float64,2},B))


# Test wjCoherence()
B = randn(3,3);
cb = wjCoherence(B)